package com.alen.sun.util;

import java.util.Random;

/**
 * 生成手机验证码--6位验证码
 */
public class PhoneCode {

    //生成6位验证码
    public static String generateCode(){
        StringBuilder sb = new StringBuilder();
        Random random = new Random();

        for (int i = 0; i < 6; i++) {
            int digit = random.nextInt(10);  // 生成0-9之间的随机数字
            sb.append(digit);

        }
        return sb.toString();
    }

}
